import React ,{useState,useEffect}from 'react'
//函数组件
export default function Fncomponent() {
    // 类似于类组件中的list  setlist修改list会用 相当于累组件中的this.setState
    const [list, setlist] = useState(["谢大脚","刘能","李泽森"])//默认值
    const btn = () =>{
        setlist( ["焦宪宗","大帅哥"])
    }
    return (
        <div>
            {
                list.map((item,index)=>{
                    return <p key={index}>{item}</p>
                  })
            }
            <button onClick={btn}>点我</button>
        </div>
    )
}
